/**
 * Created by Adil Naji.
 * User: XP-170708
 * Date: 18 nov. 2008
 * Time: 18:13:43
 */
package projects.jnurse.ioc.proxy;

import projects.jnurse.ioc.annotations.Fill;

import java.lang.reflect.Field;
import java.util.List;
import java.util.ArrayList;

public class AnnotationFilter {
    private static AnnotationFilter ourInstance = new AnnotationFilter();

    public static AnnotationFilter getInstance() {
        return ourInstance;
    }

    public List<Field> filter(Field[] fields) {
        List<Field> collectedFields = new ArrayList<Field>();
        for (Field field : fields) {
            Fill fill = field.getAnnotation(Fill.class);
            if (fill != null) {
                collectedFields.add(field);
            }

        }
        return collectedFields;
    }

    private AnnotationFilter() {
    }
}
